﻿using System;
using System.Collections.Generic;
using System.Text;
using System.ServiceModel;
using com.clinica.business.BE.actdocpago;
using com.clinica.business.BE.comun;
using com.clinica.business.BL.interfaces.actdocpago;
using com.clinica.business.BL.interfaces.gesliq;
using com.clinica.config;

namespace LiclActDocPago
{
    public class LiclDocumentoPagoController
    {
        BeginConfig config = new BeginConfig();
        public LiclDocumentoPagoController()
        { 
        
        }
        public List<ParametrosBE> Obtener_Tabla(ParametrosBE oRequest)
        {
            ChannelFactory<IDocumentoPagoBL> factory = null;
            using (factory = new ChannelFactory<IDocumentoPagoBL>(config.Context + "DocumentoPago"))
            {
                IDocumentoPagoBL oParm = factory.CreateChannel();
                List<ParametrosBE> lst = oParm.ObternerTipoDocumento(oRequest);
                factory.Close();
                return lst;
            }
        }
        public List<DocumentoPagoBE> Obtener_DocumentosPago(DocumentoPagoBE oRequest, DateTime dtFecha_Inicio, DateTime dtFecha_Fin)
        {
            ChannelFactory<IDocumentoPagoBL> factory = null;
            using (factory = new ChannelFactory<IDocumentoPagoBL>(config.Context + "DocumentoPago"))
            {
                IDocumentoPagoBL oPacie = factory.CreateChannel();
                List<DocumentoPagoBE> lst = oPacie.ObternerDocumentosPago(oRequest, dtFecha_Inicio, dtFecha_Fin);
                factory.Close();
                return lst;
            }
        }
        public List<DocumentoPagoBE> Obtener_DocumentosPago(DocumentoPagoBE oRequest)
        {
            ChannelFactory<IDocumentoPagoBL> factory = null;
            using (factory = new ChannelFactory<IDocumentoPagoBL>(config.Context + "DocumentoPago"))
            {
                IDocumentoPagoBL oPacie = factory.CreateChannel();
                List<DocumentoPagoBE> lst = oPacie.ObtenerDocumentoPago(oRequest);
                factory.Close();
                return lst;
            }
        }
        public List<com.clinica.business.BE.gesliq.PacienteBE> Buscar_Paciente_Detalle(com.clinica.business.BE.gesliq.PacienteBE oRequest)
        {
            ChannelFactory<IPacienteBL> factory = null;
            using (factory = new ChannelFactory<IPacienteBL>(config.Context + "Paciente"))
            {
                IPacienteBL oPacie = factory.CreateChannel();
                List<com.clinica.business.BE.gesliq.PacienteBE> lst = oPacie.BuscarPacienteDetalle(oRequest);
                factory.Close();
                return lst;
            }
        }
        public List<DocumentoPagoBE> Obtener_Consumos(DocumentoPagoBE oRequest)
        {
            ChannelFactory<IDocumentoPagoBL> factory = null;
            using (factory = new ChannelFactory<IDocumentoPagoBL>(config.Context + "DocumentoPago"))
            {
                IDocumentoPagoBL oPacie = factory.CreateChannel();
                List<DocumentoPagoBE> lst = oPacie.ObternerConsumos(oRequest);
                factory.Close();
                return lst;
            }
        }

        public List<DocumentoPagoBE> Obtener_Liquidacion(DocumentoPagoBE oRequest)
        {
            ChannelFactory<IDocumentoPagoBL> factory = null;
            using (factory = new ChannelFactory<IDocumentoPagoBL>(config.Context + "DocumentoPago"))
            {
                IDocumentoPagoBL oPacie = factory.CreateChannel();
                List<DocumentoPagoBE> lst = oPacie.ObternerLiquidacion(oRequest);
                factory.Close();
                return lst;
            }
        }
        public int Grabar_Documento(int Accion,DocumentoPagoBE oRequest)
        {
            ChannelFactory<IDocumentoPagoBL> factory = null;
            using (factory = new ChannelFactory<IDocumentoPagoBL>(config.Context + "DocumentoPago"))
            {
                IDocumentoPagoBL oPacie = factory.CreateChannel();
                int result = oPacie.ActualizarDocumentoPago(Accion,oRequest);
                factory.Close();
                return result;
            }
        }
    }
}
